'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  const auth = app.middleware.auth();

  router.redirect('/', '/swagger-ui.html', 302);
  router.post('/permission/getMenu', controller.permission.login);
  router.get('/home/getData', auth, controller.home.getStatisticalData);
  router.get('/user/list', controller.user.getList);
  router.post('/user/create', auth, controller.user.create);
  router.post('/user/update', auth, controller.user.update);
  router.post('/user/delete', auth, controller.user.delete);

  router.get('/media/org-list', controller.media.getOrgList);
  router.get('/media/industry-list', controller.media.getIndustryList);
  router.get('/media/receiver-list', controller.media.getReceiverlList);
  router.get('/media/list', controller.media.getMediaList);
  router.get('/media/detail', controller.media.getDetail);
  router.post('/media/create', controller.media.create);
  router.post('/media/update', controller.media.update);
  router.post('/media/receiver-add', controller.media.addReceiver);
  router.post('/media/receiver-update', controller.media.updateReceiver);
};
